Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

esUtil.h

Go to the documentation of this file.
00001 //  
00002 // Copyright notice here
00003 //
00004 
00005 //
00010 //
00011 #ifndef ESUTIL_H
00012 #define ESUTIL_H
00013 
00015 //  Includes
00016 //
00017 #include <GLES2/gl2.h>
00018 #include <EGL/egl.h>
00019 
00020 #ifdef __cplusplus
00021 
00022 extern "C" {
00023 #endif
00024 
00025    
00027 //  Macros
00028 //
00029 #define ESUTIL_API  __cdecl
00030 #define ESCALLBACK  __cdecl
00031 
00032 
00034 #define ES_WINDOW_RGB           0
00035 
00036 #define ES_WINDOW_ALPHA         1 
00037 
00038 #define ES_WINDOW_DEPTH         2 
00039 
00040 #define ES_WINDOW_STENCIL       4
00041 
00042 #define ES_WINDOW_MULTISAMPLE   8
00043 
00044 
00046 // Types
00047 //
00048 
00049 typedef struct
00050 {
00051     GLfloat   m[4][4];
00052 } ESMatrix;
00053 
00054 typedef struct
00055 {
00057    void*       userData;
00058 
00060    GLint       width;
00061 
00063    GLint       height;
00064 
00066    NativeWindowType  hWnd;
00067 
00069    EGLDisplay  eglDisplay;
00070       
00072    EGLContext  eglContext;
00073 
00075    EGLSurface  eglSurface;
00076 
00078    void (ESCALLBACK *drawFunc) ( void* );
00079    void (ESCALLBACK *keyFunc) ( void*, unsigned char, int, int );
00080    void (ESCALLBACK *updateFunc) ( void*, float deltaTime );
00081 } ESContext;
00082 
00083 
00085 //  Public Functions
00086 //
00087 
00088 //
00092 //
00093 void ESUTIL_API esInitContext ( ESContext *esContext );
00094 
00095 //
00108 GLboolean ESUTIL_API esCreateWindow ( ESContext *esContext, const char *title, GLint width, GLint height, GLuint flags );
00109 
00110 //
00113 //
00114 void ESUTIL_API esMainLoop ( ESContext *esContext );
00115 
00116 //
00120 //
00121 void ESUTIL_API esRegisterDrawFunc ( ESContext *esContext, void (ESCALLBACK *drawFunc) ( ESContext* ) );
00122 
00123 //
00127 //
00128 void ESUTIL_API esRegisterUpdateFunc ( ESContext *esContext, void (ESCALLBACK *updateFunc) ( ESContext*, float ) );
00129 
00130 //
00134 //
00135 void ESUTIL_API esRegisterKeyFunc ( ESContext *esContext, 
00136                                     void (ESCALLBACK *drawFunc) ( ESContext*, unsigned char, int, int ) );
00137 //
00140 //
00141 void ESUTIL_API esLogMessage ( const char *formatStr, ... );
00142 
00143 //
00149 //
00150 GLuint ESUTIL_API esLoadShader ( GLenum type, const char *shaderSrc );
00151 
00152 //
00159 //
00160 GLuint ESUTIL_API esLoadProgram ( const char *vertShaderSrc, const char *fragShaderSrc );
00161 
00162 
00163 //
00173 //
00174 int ESUTIL_API esGenSphere ( int numSlices, float radius, GLfloat **vertices, GLfloat **normals, 
00175                              GLfloat **texCoords, GLuint **indices );
00176 
00177 //
00187 //
00188 int ESUTIL_API esGenCube ( float scale, GLfloat **vertices, GLfloat **normals, 
00189                            GLfloat **texCoords, GLuint **indices );
00190 
00191 //
00197 //
00198 char* ESUTIL_API esLoadTGA ( char *fileName, int *width, int *height );
00199 
00200 
00201 //
00205 //
00206 void ESUTIL_API esScale(ESMatrix *result, GLfloat sx, GLfloat sy, GLfloat sz);
00207 
00208 //
00212 //
00213 void ESUTIL_API esTranslate(ESMatrix *result, GLfloat tx, GLfloat ty, GLfloat tz);
00214 
00215 //
00220 //
00221 void ESUTIL_API esRotate(ESMatrix *result, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
00222 
00223 //
00224 // \brief multiply matrix specified by result with a perspective matrix and return new matrix in result
00229 //
00230 void ESUTIL_API esFrustum(ESMatrix *result, float left, float right, float bottom, float top, float nearZ, float farZ);
00231 
00232 //
00239 //
00240 void ESUTIL_API esPerspective(ESMatrix *result, float fovy, float aspect, float nearZ, float farZ);
00241 
00242 //
00248 //
00249 void ESUTIL_API esOrtho(ESMatrix *result, float left, float right, float bottom, float top, float nearZ, float farZ);
00250 
00251 //
00255 //
00256 void ESUTIL_API esMatrixMultiply(ESMatrix *result, ESMatrix *srcA, ESMatrix *srcB);
00257 
00258 //
00261 //
00262 void ESUTIL_API esMatrixLoadIdentity(ESMatrix *result);
00263 
00264 #ifdef __cplusplus
00265 }
00266 #endif
00267 
00268 #endif // ESUTIL_H

Generated on Thu Jan 31 11:29:22 2008 for ES Framework by doxygen 1.3.6